import request from '@/utils/request'

export const baseUrl = '/system/api-scope'
export const baseApiName = '接口权限'

export function create(data) {
	return request({
		url: `${baseUrl}`,
		method: 'post',
		data,
		apiName: `${baseApiName}创建`
	})
}

export function findAll(params) {
	return request({
		url: `${baseUrl}`,
		method: 'get',
		params,
		apiName: `${baseApiName}列表`
	})
}

export function findOne(id) {
	return request({
		url: `${baseUrl}/${id}`,
		method: 'get',
		apiName: `${baseApiName}更具id查询`
	})
}

export function update(id, data) {
	return request({
		url: `${baseUrl}/${id}`,
		method: 'patch',
		data,
		apiName: `${baseApiName}修改`
	})
}

export function remove(id) {
	return request({
		url: `${baseUrl}/${id}`,
		method: 'delete',
		apiName: `${baseApiName}删除`
	})
}

export function findApiByMenuTree(params) {
  return request({
    url: `${baseUrl}/findApiByMenuTree`,
    method: 'get',
    params
  })
}

export function getApiIdByRoleId(params) {
  return request({
    url: `role-api/getApiIdByRoleId`,
    method: 'get',
    params
  })
}



